script_enemy_main{

let angle=rand(0,360);

let character="SetsukoShinichi";
let cutin=character;
let dispelled=0;
let spellcards=2;
let spellcardnumber=4;
let damagerate=10;
let outfit=1;
outfit=(128*outfit)-128;
let usespell=0;
let bgfade=0;
let frame=0;
let time=0;
let miny=GetClipMinY; let maxy=GetClipMaxY; let minx=GetClipMinX; let maxx=GetClipMaxX;
let cx=GetCenterX; let cy=GetCenterY;

let SEshot1=("script\SoundEffects\shots3.wav");
let SEshot2=("script\SoundEffects\shots5.wav");
let SEshot3=("script\SoundEffects\shotb6.wav");

let BG1=("\script\Images\BackgroundLayers\setsuko1.png");
let BG2=("\script\Images\BackgroundLayers\setsuko2.png");

#include_function "script/Functions/SetSpellcardCommonData.txt";
#include_function "script/Functions/SpellcardNameLoad.txt";
#include_function "script/Functions/HealthBarLoad.txt";
#include_function "script/Functions/CutInLoad.txt";

@Initialize{
	LoadUserShotData("script\shots\ShotsSetsukoShinichi1.txt");

	LoadGraphic("\script\Images\BackgroundLayers\setsuko1.png");
	LoadGraphic("\script\Images\BackgroundLayers\setsuko2.png");

	LoadSE("script\SoundEffects\shots3.wav");
	LoadSE("script\SoundEffects\shots5.wav");
	LoadSE("script\SoundEffects\shotb6.wav");

	SetScore(100000);
	SetLife(175);
	SetTimer(40);
	SetInvincibility(120);

	MagicCircle(false);
	SetX(cx);
	SetY(miny-1000);
}
	
@MainLoop{

SetCollisionA(GetCommonData("Boss1X"),GetCommonData("Boss1Y"),16);
SetCollisionA(GetCommonData("Boss2X"),GetCommonData("Boss2Y"),16);
SetCollisionB(GetCommonData("Boss1X"),GetCommonData("Boss1Y"),16);
SetCollisionB(GetCommonData("Boss2X"),GetCommonData("Boss2Y"),16);
SetShotAutoDeleteClip(64,64,64,64);

Weakness(character);
#include_function "script/Functions/Weakness.txt";
if(GetCommonData("BombOn")==0){ damagerate=10; }
if(GetCommonData("BombOn")==1){ damagerate=4; }
SetDamageRate(damagerate*weaken,damagerate*weaken);

let difficulty="";
if(GetCommonDataDefault("Difficulty",2)==1){ difficulty="Easy"; }
if(GetCommonDataDefault("Difficulty",2)==2){ difficulty="Normal"; }
if(GetCommonDataDefault("Difficulty",2)==3){ difficulty="Hard"; }
if(GetCommonDataDefault("Difficulty",2)==4){ difficulty="Lunatic"; }

SpellcardName("Authority [Good Cop, Bad Cop] ("~difficulty~")",spellcardnumber); 
HealthBar();
Portrait(cutin,1);


if(time==0){
CreateEnemyFromFile((GetCurrentScriptDirectory~"Setsuko-Shinichi - Good Cop Bad Cop - Setsuko.txt"),GetCommonData("Boss1X"),GetCommonData("Boss1Y"),0,0,0);
CreateEnemyFromFile((GetCurrentScriptDirectory~"Setsuko-Shinichi - Good Cop Bad Cop - Shinichi.txt"),GetCommonData("Boss2X"),GetCommonData("Boss2Y"),0,0,0);
}


if(time%180==0){ SetCommonData("NewX",rand(30,150)); SetCommonData("NewY",rand(50,150)); }

if(time%6==0 && time>=120){
let shot1=0;
let shot2=0;
let speed=0;
	loop(3){
		loop(3){
		CreateShotA(shot1,GetCommonData("Boss1X"),GetCommonData("Boss1Y")-5,0);
		SetShotDataA(shot1,0,3-speed,-angle-(speed*6),0,0,0,3);
		FireShot(shot1);

		CreateShotA(shot2,GetCommonData("Boss2X"),GetCommonData("Boss2Y")-15,0);
		SetShotDataA(shot1,0,3-speed,angle+(speed*6),0,0,0,13);
		FireShot(shot2);
		angle+=120;
		}
	speed+=0.25;
	}
angle+=13;
PlaySE(SEshot1);
}

if((time+0)%600==0 && time>=60){
let shot1=0;
let a=0;
let b=0;
	loop(4){
		loop(60){
		CreateShotA(shot1,GetCommonData("Boss1X")+5,GetCommonData("Boss1Y")-15,0);
		SetShotDataA(shot1,0,rand(2,4),rand(0,360),0,rand(-0.05,-0.08),0,12);
		SetShotDirectionType(PLAYER);
		SetShotDataA(shot1,60+a,5,b,0,0,0,11);
		SetShotDirectionType(ABSOLUTE);
		FireShot(shot1);
		a+=1;
		}
	a=0;
	b+=90;
	}
let angle=0;
	loop(20){
	CreateShot01(GetCommonData("Boss2X")-10,GetCommonData("Boss2Y")-30,2.5,angle,36,10);
	angle+=360/20;
	}
PlaySE(SEshot3);
SetCommonData("UseSpell1",60);
}
if((time+300)%600==0 && time>=60){
let shot1=0;
let a=0;
let b=0;
	loop(4){
		loop(60){
		CreateShotA(shot1,GetCommonData("Boss2X")-10,GetCommonData("Boss2Y")-30,0);
		SetShotDataA(shot1,0,rand(2,4),rand(0,360),0,rand(-0.05,-0.08),0,23);
		SetShotDirectionType(PLAYER);
		SetShotDataA(shot1,60+a,5,b,0,0,0,24);
		SetShotDirectionType(ABSOLUTE);
		FireShot(shot1);
		a+=1;
		}
	a=0;
	b+=90;
	}
let angle=0;
	loop(20){
	CreateShot01(GetCommonData("Boss1X")+5,GetCommonData("Boss1Y")-15,2.5,angle,35,10);
	angle+=360/20;
	}
PlaySE(SEshot3);
SetCommonData("UseSpell2",60);
}

if(frame>=60 && frame<120 && time%8==0 && time>=300){ PlaySE(SEshot2); }

if(frame==300){ frame=0; }


time++; frame++;
if(usespell>0){ usespell--; } if(usespell<0){ usespell++; }

#include_function "script/Functions/SpellcardName.txt";
#include_function "script/Functions/HealthBar.txt";
#include_function "script/Functions/CutIn.txt";
}

@BackGround{
	if(bgfade<255){bgfade+=5;}

	SetGraphicRect(0,0,300,400);
	SetGraphicScale(1.3,1.3);
	SetTexture(BG1);
	SetAlpha(bgfade/2);
	SetColor(255,255,255);
	SetRenderState(ALPHA);
	SetGraphicAngle(0,0,0);
	DrawGraphic(cx,cy);
	
	SetGraphicRect(0,0,250,320);
	SetGraphicScale(1.25,1.25);
	SetAlpha(bgfade);
	SetColor(180,180,180);
	SetTexture(BG2);
	DrawGraphic(cx,cy);
}

@DrawLoop{
}

@Finalize{
//	SetCommonData("Conversation",1);
	if(GetCommonData("Difficulty")==4){ SetCommonData("ItemSpawn",1); }
	NewPointData(spellcardnumber,GetCommonData("Difficulty"));
	#include_function "script/Functions/Main Menu/SpellcardDataAndPoints.txt";
}

}